#!/usr/bin/env python
"""
# -*- coding: utf-8 -*-
# @Time    : 2020/9/20 15:01
# @Author  : AshJo
# @Desc    : 组合
# @Filename: combination.py
# @Version : v1.0
"""


# 一个类的对象是另一个对象的属性

# class Student:
#     def __init__(self, name, sex, age, number, clas, phone):
#         self.name = name
#         self.sex = sex
#         self.age = age
#         self.number = number
#         self.clas = clas
#         self.phone = phone
#
#
# class Clas:
#     def __init__(self, cname, begin, teacher):
#         self.cname = cname
#         self.begin = begin
#         self.teacher = teacher
#
#
# c1 = Clas('计算机网络技术2班', '2020-9-20', '苍老师')
# s1 = Student('小明', 'man', 18, 140701, c1, 13011012019)
#
# # 对象变成一个属性 - 组合
# print(s1.clas.cname)
# print(s1.clas.begin)
# print(s1.clas.teacher)


class Clas:
    def __init__(self, course):
        self.course = course


class Course:
    def __init__(self, cname, ctime, cprice):
        self.cname = cname
        self.ctime = ctime
        self.cprice = cprice


linux57 = Course('linux57', '8个月', 8888)
python22 = Course('python22', '9个月', 9999)

c1 = Clas(linux57)
c2 = Clas(python22)

print(c1.course.cprice)
print(c2.course.ctime)
